#To prove that the lazy and non lazy versions of the pipeline 
#redefine distinct to print out the values it has 'seen'

def distinct(iterable):
    """Return unique items by eliminating duplicates.

    Args:
        iterable: The source of the items.

    Yields:
        Unique elements in order from 'iterable'.
    """
    seen = set()
    for item in iterable: 
        if item in seen:
            continue 
        yield item 
        seen.add(item)
    print(seen)

run_pipeline() #It should have seen all found values: {1, 2, 3, 6}


#Now go back to the lazy version
def run_pipeline():
    items = [3, 6, 6, 2, 1, 1]
    for item in take(3, distinct(items)): 
        print(item)

        
run_pipeline() #Seen won't even be printed, it hasn't got that far yet!